import { useEffect } from 'react'
import { Outlet, useLocation, useNavigate } from 'react-router-dom'
import AppStyle from './index.module.scss'
const App = () => {
	const { pathname } = useLocation()
	const navigate = useNavigate()
	// 用于登录验证 ，tacken验证
	useEffect(() => {
		const token = localStorage.getItem('token')
		// 判断tocken标识
		if (!token) {
			navigate('/login')
		}
	}, [navigate, pathname])
	return (
		<div className={AppStyle.index}>
			{/* 一级视图出口 */}
			<Outlet />
		</div>
	)
}
export default App
